import { getUserInfo } from '../../../../common/api/index'
Page({
	data: {
		userInfo:{},
		userParentInfo:{},
		orderList:[
			{name:'未付款',img:'/static/image/daifukuan.png',status:'1',index:1 },
			{name:'待发货',img:'/static/image/daifahuo.png',status:'2,11',index:2 },
			{name:'已发货',img:'/static/image/yifahuo.png',status:'3',index:3 },
			{name:'已收货',img:'/static/image/yishouhuo.png',status:'4',index:4  },
			{name:'售后',img:'/static/image/shouhou.png',status:'5,6',index:5  },
		],
		walletList:[
			{name:'余额',img:'/static/image/order.png',btn:'提现',money:0,path:"/pages/component/mine/wallet/walletDetail/index"},
			{name:'待到帐余额',img:'/static/image/order.png',money:0,path:"/pages/component/mine/wallet/walletFreezeDetail/index"},
		],
		serviceList:[
			{name:'地址管理',img:'/static/image/dizhiguanli.png',path: "/pages/component/mine/addrress/index/index"},
			{name:'用户协议',img:'/static/image/yonghuxieyi.png',path: "/pages/component/mine/userAgreement/index/index"},
		],
	},
	clickToPath(e){
		let path = e.currentTarget.dataset.path;
		wx.$goTo(path,true)
	},
	onLoad(options) {

	},
	onShow() {
		this.getUserInfoData()
	},
	getUserInfoData(){
		getUserInfo().then(res => {
			if(res.code == 200){
				let data = this.data.walletList;
				if(res.data.user.balance >= 0){
					data[0].money = res.data.user.balance
					data[1].money = res.data.user.freeze
				}
				this.setData({
					walletList: data,
					userInfo: res.data.user,
					userParentInfo: res.data.userPar,
				})
			}
		})
	},
})